package com.qd.panda.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 商品统计
 *
 * @author sjk
 */
@Getter
@Setter
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("panda_commodity_statistics")
public class CommodityStatistics extends Model<CommodityStatistics> implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "commodity_statistics_id", type = IdType.ASSIGN_ID)
    private String commodityStatisticsId;
    /**
     * 商品统计类型:1查看2支付成功
     */
    @TableField("product_statistics_type")
    private Integer productStatisticsType;
    /**
     * 操作时间
     */
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @TableField("add_time")
    private LocalDateTime addTime;
    /**
     * 是否同步:0否1是
     */
    @TableField("sync_state")
    private Integer syncState;
    /**
     * 商品ID
     */
    @TableField("commodity_id")
    private String commodityId;
    /**
     * 用户ID
     */
    @TableField("user_id")
    private String userId;

    public void freeData() {
        this.commodityStatisticsId = null;
        this.productStatisticsType = null;
        this.addTime = null;
        this.syncState = null;
        this.commodityId = null;
        this.userId = null;
    }

}
